package com.ea.eadp.nexus.test.workflow.pc.register;

import org.openqa.selenium.WebDriver;
import org.testng.Assert;

import com.ea.eadp.nexus.test.pageDefinition.pc.UnderageRegisterCompletePage;
import com.ea.eadp.nexus.test.workflow.WorkflowElement;
import com.ea.eadp.nexus.test.workflow.WorkflowElementArgument;

public class UnderageRegisterCompleteWorkflowElement extends WorkflowElement {
    
    protected UnderageRegisterCompletePage page;
    
    public UnderageRegisterCompleteWorkflowElement(
        WebDriver driver, WorkflowElementArgument args
    ) {
        super(driver, args);
        page = new UnderageRegisterCompletePage(driver);
    }
    
    @Override
    public void init() {
        super.init();
        page.initPage();
    }
    
    @Override
    public void doVerification() {
        super.doVerification();
        String headerText = page.txt_header.getText();
        Assert.assertTrue(
            headerText.contains( args.originId.toUpperCase() )
            , "Origin ID display wrong: \"" + headerText + "\""
        );
    }
    
    @Override
    public void moveNext() {
        page.btn_close.click();
    }
    
}
